﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Chapter6Classes;
using NorthwindPocoClasses;

namespace Chapter6PracticeHostApp
{
	class Program
	{
		static void Main(string[] args)
		{
			Chapter6Worker.Work();

			//using (var pocoContext = new NorthwindPocoObjectContext())
			//{
			//    QueryPocoClasses(pocoContext);
			//}
		}

		private static void QueryPocoClasses(NorthwindPocoObjectContext pocoContext)
		{
			var customers = from c in pocoContext.Customers
			                join o in pocoContext.Orders
			                	on c.CustomerID equals o.CustomerID
			                select new
			                       	{
										c.CustomerID,
										c.CompanyName,
										o.OrderID,
										o.OrderDate
			                       	};
			foreach (var customer in customers)
			{
				Console.WriteLine("CustomerID - {0}; CompanyName - {1}; OrderID - {2}; OrderDate - {3}", customer.CustomerID, customer.CompanyName, customer.OrderID, customer.OrderDate);
			}
		}
	}
}
